package ch01;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @author zhu
 * @date 2024-03-29
 */
public class People<T> {
    private String name;
    private T data;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void GuangJie() throws Exception {
        Class<?> clazz = this.data.getClass();
        Method[] methods = clazz.getMethods();

        System.out.println(name + "带着" + methods[0].invoke(this.data) + "逛街");
        System.out.println(methods[2].invoke(this.data));
    }
}
